Skip to content

Add support for postgres advisory locks#1062

Merged
Expurple merged 2 commits intoSeaQL:masterfrom
NeelChotai:neel/pg-advisory-locks
Mar 24, 2026
Merged

Add support for postgres advisory locks#1062
Expurple merged 2 commits intoSeaQL:masterfrom
NeelChotai:neel/pg-advisory-locks

Conversation

@NeelChotai
Copy link
Contributor

@NeelChotai NeelChotai commented Mar 23, 2026

PR Info

This PR adds support for Postgres advisory locks: https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS

I was considering just adding one advisory_lock function, and instead having:

pub enum PgFunc {
...
  AdvisoryLock(AdvisoryLock)
}

pub enum AdvisoryLock {
    AdvisoryLock,
    AdvisoryLockShared,
    TryAdvisoryLock,
    TryAdvisoryLockShared,
    AdvisoryUnlock,
    AdvisoryUnlockShared,
    AdvisoryUnlockAll,
    AdvisoryXactLock,
    AdvisoryXactLockShared,
    TryAdvisoryXactLock,
    TryAdvisoryXactLockShared,
}

However this felt a bit messy, and breaking with current conventions.

New Features

  • Support for Postgres advisory locks

Bug Fixes

Breaking Changes

Changes

@Huliiiiii Huliiiiii requested review from Expurple and tyt2y3 March 23, 2026 12:09
@Huliiiiii
Copy link
Member

I did some refactor in #1063. Now FunctionCall::new accepts Into, so you can simplify the code a bit.

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch from 608ad6e to a94d502 Compare March 23, 2026 12:47
@NeelChotai
Copy link
Contributor Author

I did some refactor in #1063. Now FunctionCall::new accepts Into, so you can simplify the code a bit.

updated!

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch 2 times, most recently from b731a0e to 66745a3 Compare March 23, 2026 12:56
@Huliiiiii
Copy link
Member

You can just use FunctionCall::new(PgFunc::...).

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch from 66745a3 to 50f4e77 Compare March 23, 2026 13:06
@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch from 50f4e77 to 3de3343 Compare March 23, 2026 15:22
Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Expurple Expurple merged commit d4aef75 into SeaQL:master Mar 24, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants